package sword_to_1;

import node.TreeNode;

public class LeeCode_28 {
    public static void main(String[] args) {

    }
    private static boolean isSymmetric(TreeNode root) {
        if (root == null){
            return true;
        }
        return dfs(root.left, root.right);
    }
    private static boolean dfs(TreeNode l, TreeNode r){
        if (l == null && r == null){
            return true;
        }
        if (l == null || r == null){
            return false;
        }
        if (l.val != r.val)
            return false;
        return dfs(l.right, r.left) && dfs(l.left, r.right);
    }
}
